package com.agritech.chain;

/**
 * 障碍物处理器
 */
public class ObstacleHandler extends SafetyHandler {
    @Override
    public void handleSafetyEvent(SafetyEvent event) {
        if (event.getType() == SafetyEvent.EventType.OBSTACLE_DETECTED) {
            System.out.println("障碍物处理器：检测到障碍物，启动紧急避障程序");
            if (event.getSeverity() >= 4) {
                System.out.println("严重障碍物威胁，停止作业并通知控制中心");
            } else {
                System.out.println("尝试绕过障碍物继续作业");
            }
        } else {
            passToNextHandler(event);
        }
    }
}